﻿using System.Collections.Generic;
using System;
using GraphMLComplexType;
using System.Reflection;
using System.Runtime.Serialization;

namespace GraphInformation
{
    [DataContract]
    public class GraphElement : IGraphMLComplexType
    {
        private Dictionary<String, String> m_keys;
        private int m_id;


        public GraphElement()
        {
            m_keys = new Dictionary<string, string>();
            m_id = this.GetHashCode();
        }

        public GraphElement(Dictionary<string, string> dict)
        {
            m_keys = dict;
        }

        [DataMember]
        public int Id
        {
            get { return m_id; }
            set { m_id = value; }
        }

        [DataMember]
        public double x;

        [DataMember]
        public double y;

        [DataMember]
        public double Width;

        [DataMember]
        public double Height;

        #region IGraphMLComplexType Members

        [DataMember]
        public Dictionary<string, string> Keys
        {
            get { return m_keys; }
            set { m_keys = value; }
        }

        #endregion
    }

    [DataContract]
    public class GraphEdge
    {
        private int m_source;
        

        private int m_target;
        
        public GraphEdge()
        { 
            
        }



        public GraphEdge(GraphElement source, GraphElement target)
        {
            m_source = source.GetHashCode();
            m_target = target.GetHashCode();
        }


        [DataMember]
        public int Source
        {
            get { return m_source; }
            set { m_source = value; }
        }

        [DataMember]
        public int Target
        {
            get { return m_target; }
            set { m_target = value; }
        }
    }

    [DataContract]
    public class Graph
    {
        private Dictionary<int, GraphElement> m_Vertices = new Dictionary<int,GraphElement>();
        private GraphEdge[] m_Edges;

        [DataMember]
        public GraphEdge[] Edges
        {
            get { return m_Edges; }
            set { m_Edges = value; }
        }

        [DataMember]
        public Dictionary<int, GraphElement>  Vertices
        {
            get { return m_Vertices; }
            set { m_Vertices = value; }
        }

        [DataMember]
        public double Width;

        [DataMember]
        public double Height;
    }
}